#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>

//@  变量

void test1(){
    //1.直接修改
    int a = 10;
    a= 20;

    //2.间接修改
    int *p = &a;
    *p = 30;
    printf("a=%d\n", a);
}


struct Person{   // 内存对齐  地址偏移
    char a;
    int b;
    char c;
    int d;
};

void test2(){
    struct Person p = {'a',10,'b',20};

    // 直接修改 d
    p.d = 100;

    //间接修改
    struct Person * pp = &p;
    pp->d = 101;

    printf("%d\n", pp);
    printf("%d\n", pp+1); // 偏移一个结构体 16

    char * pp = &pp;

    *(int*)(pp+12) = 102;   // 指针偏移修改值
}


int main(){





    system("pause");
    return EXIT_SUCCESS;
}